package br.com.atibrasil.fx.aplication;

import java.io.IOException;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import br.com.atibrasil.model.MenuItem;

public class GUIErroICMSEntrada extends Application implements GUIApplicationInterface {
	MenuItem menuItem = new MenuItem();
	@Override
	public void start(Stage arg0) throws Exception {
		execute();
	}
	
	@Override
	public void execute(MenuItem menuItem) {
		this.menuItem = menuItem;
		execute();
	}

	public static void main(String[] args) {
		launch(null);
	}	
	@Override
	public void execute(){
		Parent root;		
		try {
			root = FXMLLoader.load(GUIController.class.getResource("/br/com/atibrasil/fx/fxml/erroICMSEntradaForm.fxml"));	
		
		} catch (IOException e) {
			e.printStackTrace();
			return;
		}		
		Scene scene = new Scene(root);
		Stage stage = new Stage();
		stage.setScene(scene);		
		stage.setResizable(false);
		stage.initModality(Modality.APPLICATION_MODAL);
		stage.initStyle(StageStyle.UTILITY);
		if (menuItem.getImagem() != null) {
			Image img = new Image("/br/com/atibrasil/images/"+menuItem.getImagem());
			stage.getIcons().add(img);
			stage.setTitle(menuItem.getDescricao());
		}
		stage.sizeToScene();		
		stage.show();				
	}



}
